<?php

/**
 * AimUser form.
 *
 * @package    sf_sandbox
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class AimUserForm extends BaseAimUserForm
{
  public function configure()
  {
    unset($this['password'], $this['thumbnail']);
    
    $this->setWidget('password', new sfWidgetFormInputHidden());
    $this->setWidget('new_password', new sfWidgetFormInputPassword(array('label' => 'New Password',), array()));
    $this->setWidget('confirm_password', new sfWidgetFormInputPassword(array('label' => 'Confirm Password',), array()));
    $this->setWidget('address', new sfWidgetFormCKEditor(array(), array('rows' => 5, 'cols' => 50)));
    
    $this->setValidator('password', new sfValidatorPass());
    $this->setValidator('new_password', new sfValidatorPass());
    $this->setValidator('confirm_password', new sfValidatorPass());  
    $this->setValidator('tel', new sfValidatorInteger(array('required' => false, )));
    $this->setValidator('mobile', new sfValidatorInteger(array('required' => false, )));
    $this->setValidator('address', new sfValidatorString(array('required' => false, )));
    $this->setValidator('role', new sfValidatorDoctrineChoice(
      array('model' => $this->getRelatedModelName('AimRole'),
            'required' => true
    )));
  }
  public function configureNewUser() {
    $this->setValidator('new_password', new sfValidatorString());
    $this->setValidator('confirm_password', new sfValidatorString());
  }  
}
